﻿<Window x:Class="RenjianImageViewer.View.Window.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:control="clr-namespace:RenjianImageViewer.View.Control"
        xmlns:fluid="clr-namespace:FluidKit.Controls"
        xmlns:vm="clr-namespace:RenjianImageViewer.ViewModel"
        Title="Renjian Image Viewer Ver. 0.4.3" WindowStartupLocation="CenterScreen"
        Icon="/RenjianImageViewer;component/Resource/Media/Icon/AppIcon.ico">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/View/Control/ElementFlow/Style/ElementFlow.Generic.xaml"/>
                <ResourceDictionary Source="/View/Style/ColorBrushTheme.xaml"/>
                <ResourceDictionary Source="/View/Style/ControlTemplate.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            <BooleanToVisibilityConverter x:Key="bool2VisibilityConverter"/>
            <DataTemplate x:Key="TestDataTemplate">
                <Border x:Name="ElementVisual"
                        Background="{StaticResource LayerBrush}"
                        Padding="5"
                        BorderThickness="5"
                        BorderBrush="{StaticResource ButtonBrush}"
                        Grid.Row="0">
                    <Image Source="{Binding Thumbnail}"
                           Stretch="Uniform" />
                </Border>
            </DataTemplate>
        </ResourceDictionary>
    </Window.Resources>

    <Grid Background="{StaticResource BackgroundBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="auto"/>
        </Grid.RowDefinitions>
        <ContentControl x:Name="BigImage" Margin="10"/>
        <ProgressBar x:Name="progressBarLoading" Width="100" Height="6" Value="{Binding Percentage}" Visibility="Collapsed" />
        <Popup x:Name="PopupTools" Placement="MousePoint" VerticalOffset="-40" HorizontalOffset="-40" AllowsTransparency="True" StaysOpen="False">
            <Grid Width="80" Height="80" Background="{x:Null}">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <Button PreviewMouseUp="SaveImageButtonClicked" Height="30" Background="{StaticResource ButtonBrush}">
                    <Grid Width="60">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Image Source="../../Resource/Media/Image/Save.png" Width="16" Height="16" Margin="0,0,2,0"/>
                        <TextBlock Grid.Column="1">Save</TextBlock>
                    </Grid>
                </Button>
                <Button Grid.Row="2" PreviewMouseUp="SaveAllButtonClicked" Height="30" Background="{StaticResource ButtonBrush}">
                    <Grid Width="60">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Image Source="../../Resource/Media/Image/SaveAll.png" Width="16" Height="16" Margin="0,0,2,0"/>
                        <TextBlock Grid.Column="1">Save All</TextBlock>
                    </Grid>
                </Button>
            </Grid>
        </Popup>
        <!--<Image x:Name="BigImage"
               Stretch="Uniform" StretchDirection="DownOnly"
               MaxWidth="{Binding Source.PixelWidth, RelativeSource={RelativeSource Self}}"
               MaxHeight="{Binding Source.PixelHeight, RelativeSource={RelativeSource Self}}" Margin="10">
        </Image>-->
        
        <!--Tool panel-->
        <Border DataContext="{Binding ElementName=BigImage, Path=DataContext}" Background="{StaticResource ToolPanelBrush}"
                VerticalAlignment="Top" HorizontalAlignment="Stretch">
            <Border.Resources>
                <DataTemplate DataType="{x:Type vm:ImageViewModel}">
                    <Grid HorizontalAlignment="Center" MaxWidth="500">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="50"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <Image Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" Margin="3"
                               Source="{Binding StatusModel.User.Avater}"/>
                        <TextBlock Grid.Column="1"
                                   Text="{Binding StatusModel.User.NickName, StringFormat=\{0\}:}"
                                   FontSize="16" Foreground="{Binding StatusModel.User.Gender}"/>
                        <TextBlock Grid.Column="1" Grid.Row="1" Text="{Binding StatusModel.SingleLineText}"
                                   FontSize="12" Foreground="{StaticResource TextBrush}"
                                   TextTrimming="WordEllipsis" ToolTip="{Binding StatusModel.Text}"/>
                        <StackPanel Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="2"
                                    HorizontalAlignment="Center" Orientation="Horizontal">
                            <Image Source="../../Resource/Media/Image/Save.png" Width="16" Height="16" Margin="2"/>
                            <Image Source="../../Resource/Media/Image/SaveAll.png" Width="16" Height="16" Margin="2"/>
                            <Image Source="../../Resource/Media/Image/Favorite.png" Width="16" Height="16" Margin="2"/>
                        </StackPanel>
                    </Grid>
                </DataTemplate>
            </Border.Resources>
            <ContentControl Content="{Binding}"/>
        </Border>
        
        <!--Conversition Image List-->
        <ListBox HorizontalAlignment="Right" VerticalAlignment="Bottom" Background="{StaticResource ToolPanelBrush}"
                 BorderThickness="0" x:Name="conversitionImageList"
                 ItemsSource="{Binding ConversitionImages}" SelectionChanged="imageList_SelectionChanged">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <VirtualizingStackPanel Orientation="Horizontal"/>
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Border>
                        <Image Source="{Binding Thumbnail}" Width="50" Height="50" Stretch="Uniform"/>
                    </Border>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <!--New added images-->
        <ItemsControl HorizontalAlignment="Left" VerticalAlignment="Bottom" Background="{x:Null}" BorderThickness="0"
                      ItemsSource="{Binding NewImages}">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Border>
                        <Grid>
                            <Image Source="{Binding Thumbnail}" Width="100" Height="100" Stretch="Uniform"/>
                            <Ellipse Width="5" Height="5" Fill="{StaticResource NotifyBrush}"
                                     HorizontalAlignment="Right" VerticalAlignment="Bottom" />
                        </Grid>
                    </Border>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
        
        <Grid Grid.Row="1" MinHeight="102">
            <Grid.Resources>
                <Style TargetType="{x:Type Button}" BasedOn="{StaticResource NavButton}"/>
                <Style TargetType="{x:Type RepeatButton}" BasedOn="{StaticResource NavButton}"/>
            </Grid.Resources>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <!--<RepeatButton Width="25" Grid.Column="0" Content="&lt;" Delay="500" Interval="100"
                          ClickMode="Hover" Click="RepeatButtonLeft_Click"/>-->
            <Grid Width="25" Grid.Column="0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <RepeatButton Grid.Row="0" Delay="500" Interval="100"
                          ClickMode="Hover" Click="RepeatButtonLeft_Click">
                    <Image Source="../../Resource/Media/Image/NavBack.png"/>
                </RepeatButton>
                <Button Grid.Row="1" Click="ButtonNavigateHead_Click">
                    <Image Source="../../Resource/Media/Image/NavFirst.png"/>
                </Button>
            </Grid>
            <!--Main image list-->
            <ListBox Grid.Column="1" HorizontalAlignment="Center" x:Name="imageList" ItemsSource="{Binding Images}"
                     Background="{x:Null}" BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Hidden"
                     SelectionChanged="imageList_SelectionChanged" PreviewMouseWheel="imageList_MouseWheel"
                     FocusVisualStyle="{x:Null}">
                <ListBox.Resources>
                    <Style TargetType="{x:Type ListBoxItem}">
                        <Setter Property="Background" Value="Transparent"/>
                        <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
                        <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
                        <Setter Property="Padding" Value="2,0,0,0"/>
                        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="20"/>
                                            <RowDefinition Height="*"/>
                                        </Grid.RowDefinitions>
                                        <Border CornerRadius="3,3,0,0" HorizontalAlignment="Left" Padding="2"
                                                BorderThickness="1,1,1,0" BorderBrush="#77FFFFFF"
                                                Visibility="{Binding DisplayTimeTag, Converter={StaticResource bool2VisibilityConverter}}">
                                            <Border.Background>
                                                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                                    <GradientStop Color="#55000000" Offset="0.0" />
                                                    <GradientStop Color="#55FFFFFF" Offset="1.0" />
                                                </LinearGradientBrush>
                                            </Border.Background>
                                            <TextBlock Text="{Binding TimeTag}" FontFamily="Tahoma"
                                                       Foreground="{StaticResource TextBrush}"/>
                                        </Border>
                                        <Border Grid.Row="1" x:Name="Bd" SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
                                            <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                        </Border>
                                    </Grid>
                                    <ControlTemplate.Triggers>
                                        <Trigger Property="IsSelected" Value="true">
                                            <Setter Property="Background" TargetName="Bd" Value="{StaticResource LayerBrush}"/>
                                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
                                        </Trigger>
                                        <MultiTrigger>
                                            <MultiTrigger.Conditions>
                                                <Condition Property="IsSelected" Value="true"/>
                                                <Condition Property="Selector.IsSelectionActive" Value="false"/>
                                            </MultiTrigger.Conditions>
                                            <Setter Property="Background" TargetName="Bd" Value="{StaticResource LayerBrush}"/>
                                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
                                        </MultiTrigger>
                                        <Trigger Property="IsEnabled" Value="false">
                                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                                        </Trigger>
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </ListBox.Resources>
                <ListBox.Template>
                    <ControlTemplate TargetType="{x:Type ListBox}">
                        <Border x:Name="Bd" SnapsToDevicePixels="true" Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}" Padding="1">
                            <ScrollViewer Padding="{TemplateBinding Padding}" Focusable="false">
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                    <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                    <Border Width="80" Grid.Column="1" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                                        <control:Spinner IsRunning="{Binding IsBusy}" HorizontalAlignment="Center"/>
                                    </Border>
                                </Grid>
                            </ScrollViewer>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                            </Trigger>
                            <Trigger Property="IsGrouping" Value="true">
                                <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </ListBox.Template>
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <VirtualizingStackPanel Orientation="Horizontal"/>
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <DataTemplate.Triggers>
                            <Trigger Property="FrameworkElement.IsMouseOver" Value="True">
                                <Setter TargetName="visualBorder" Property="Border.BorderBrush"
                                        Value="{StaticResource HighlightBrush}"/>
                            </Trigger>
                        </DataTemplate.Triggers>
                        <Border Name="visualBorder" BorderThickness="1" BorderBrush="Transparent" Background="Transparent">
                            <Grid>
                                <Image Source="{Binding Thumbnail}" Width="100" Height="100"
                                       Stretch="Uniform" MouseDown="Image_MouseDown" ImageFailed="Image_ImageFailed"/>
                                <!--<Ellipse Width="5" Height="5" HorizontalAlignment="Center" VerticalAlignment="Bottom" Fill="LightGreen"
                                         Visibility="{Binding IsLocal, Converter={StaticResource ResourceKey=bool2VisibilityConverter}}"/>-->
                                <!--<Polygon HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="5"
                                         Visibility="{Binding IsLocal, Converter={StaticResource ResourceKey=bool2VisibilityConverter}, Mode=OneWay}"
                                         Points="0,9 4.5,0 10,9" Fill="#8899FF99"/>-->
                                <Image Source="../../Resource/Media/Image/Save.png" Opacity="0.7"
                                       HorizontalAlignment="Right" VerticalAlignment="Bottom"
                                       Width="16" Height="16" Margin="1"
                                       Visibility="{Binding IsLocal, Converter={StaticResource ResourceKey=bool2VisibilityConverter}, Mode=OneWay}"/>
                                <TextBlock Foreground="Red" Text="{Binding StatusID}" Visibility="Collapsed"/>
                                <ProgressBar BorderThickness="0" Background="{x:Null}" Height="3" Width="100" VerticalAlignment="Bottom" HorizontalAlignment="Center" Value="{Binding Percentage}"/>
                            </Grid>
                            <Border.ToolTip>
                                <TextBlock Text="{Binding StatusModel.CreateTime}"/>
                            </Border.ToolTip>
                        </Border>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
            <!--<RepeatButton Width="25" Grid.Column="2" Content="&gt;" Delay="500" Interval="100"
                          ClickMode="Hover" Click="RepeatButtonRight_Click"/>-->
            <Grid Width="25" Grid.Column="2">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <RepeatButton Grid.Row="0" Delay="500" Interval="100"
                          ClickMode="Hover" Click="RepeatButtonRight_Click">
                    <Image Source="../../Resource/Media/Image/NavNext.png"/>
                </RepeatButton>
                <Button Grid.Row="1" Click="ButtonNavigateEnd_Click">
                    <Image Source="../../Resource/Media/Image/NavEnd.png"/>
                </Button>
            </Grid>
        </Grid>
        <Button Grid.Row="2" Click="Button_Click" FontSize="25" Visibility="Collapsed">test</Button>

        <Grid x:Name="ConfigMask" Background="Transparent" Visibility="Collapsed" Grid.RowSpan="3"
              HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
        <TabControl x:Name="ConfigPanel" Grid.RowSpan="3"
                    HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                    TabStripPlacement="Bottom" BorderThickness="0">
            <TabControl.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#EEDEE8EA"/>
                    <GradientStop Color="#DD92CDCF" Offset="1"/>
                </LinearGradientBrush>
            </TabControl.Background>
            <TabItem>
                <TabItem.Template>
                    <ControlTemplate TargetType="{x:Type TabItem}">
                        <Border SnapsToDevicePixels="true">
                            <Grid Margin="6,0,1,0">
                                <Grid x:Name="Transform">
                                    <Border x:Name="Bd" CornerRadius="0,0,0,3" Margin="0,0,23,0"
                                            Background="{StaticResource LayerBrush}" />
                                    <Path Margin="60,0,0,0" Fill="{StaticResource LayerBrush}"
                                          Data="M6.5,2.6C4.767,0.973 2.509,0 0,0 0,0 0,19 0,19L23,19z">
                                        <Path.RenderTransform>
                                            <TransformGroup>
                                                <ScaleTransform ScaleX="1" ScaleY="-1"/>
                                                <TranslateTransform Y="19"/>
                                            </TransformGroup>
                                        </Path.RenderTransform>
                                    </Path>
                                </Grid>
                                <Border Padding="10,0,0,0">
                                    <ContentPresenter HorizontalAlignment="Left" VerticalAlignment="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" ContentSource="Header" RecognizesAccessKey="True"/>
                                </Border>
                            </Grid>
                        </Border>
                    </ControlTemplate>
                </TabItem.Template>
                <TabItem.Header>
                    <Grid>
                        <Thumb DragStarted="Thumb_DragStarted" DragDelta="Thumb_DragDelta"
                               DragCompleted="Thumb_DragCompleted">
                            <Thumb.Template>
                                <ControlTemplate>
                                    <Border Background="Transparent"/>
                                </ControlTemplate>
                            </Thumb.Template>
                        </Thumb>
                        <TextBlock IsHitTestVisible="False">Configure</TextBlock>
                    </Grid>
                </TabItem.Header>
                <Grid x:Name="ConfigContent">
                    <TextBlock Text="Coming Soon!" FontSize="96" RenderTransformOrigin="0.5,0.5"
                               HorizontalAlignment="Center" VerticalAlignment="Center">
                        <TextBlock.Effect>
                            <DropShadowEffect ShadowDepth="8"/>
                        </TextBlock.Effect>
                        <TextBlock.Foreground>
                            <LinearGradientBrush EndPoint="0.863,0.377" StartPoint="-0.037,0.3">
                                <GradientStop Color="#FFFF0A0A" Offset="0"/>
                                <GradientStop Color="#FF0996E4" Offset="0.848"/>
                            </LinearGradientBrush>
                        </TextBlock.Foreground>
                        <TextBlock.RenderTransform>
                            <RotateTransform Angle="-13.45"/>
                        </TextBlock.RenderTransform>
                    </TextBlock>
                </Grid>
            </TabItem>
        </TabControl>

        <Grid x:Name="BusyMask" Grid.RowSpan="3"
              HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
              Visibility="Collapsed">
            <Grid.Background>
                <RadialGradientBrush
                    GradientOrigin="0.5,0.5" Center="0.5,0.5" RadiusX="1" RadiusY="1">
                    <RadialGradientBrush.GradientStops>
                        <GradientStop Color="#FF000000" Offset="0" />
                        <GradientStop Color="#55111111" Offset="0.5" />
                    </RadialGradientBrush.GradientStops>
                </RadialGradientBrush>
            </Grid.Background>
            <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
                <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center"
                           Foreground="{StaticResource TextBrush}" FontSize="25">BUSY...</TextBlock>
                <control:Spinner IsRunning="True" HorizontalAlignment="Center"/>
                <ProgressBar Width="300" Height="10" Value="{Binding Percentage}"/>
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center"
                            Visibility="{Binding ShowState, Converter={StaticResource ResourceKey=bool2VisibilityConverter}}">
                    <TextBlock Text="{Binding Position}" Foreground="{StaticResource TextBrush}" FontSize="18"/>
                    <TextBlock Text=" OF " Foreground="{StaticResource TextBrush}" FontSize="14" VerticalAlignment="Bottom"/>
                    <TextBlock Text="{Binding Count}" Foreground="{StaticResource TextBrush}" FontSize="18"/>
                </StackPanel>
            </StackPanel>
        </Grid>

        <Grid Grid.RowSpan="3" Visibility="Collapsed" x:Name="RockViewGrid">
            <fluid:ElementFlow x:Name="_elementFlow"
                               ItemTemplate="{StaticResource TestDataTemplate}"
                               TiltAngle="45"
                               ItemGap="0.65"
                               FrontItemGap="0"
                               PopoutDistance="0.5"
                               ElementWidth="100"
                               ElementHeight="100">
                <!--<fluid:ElementFlow.Layout>
                    <fluid:CoverFlow />
                </fluid:ElementFlow.Layout>-->
                <fluid:ElementFlow.Background>
                    <LinearGradientBrush EndPoint="0.5,1"
                                         StartPoint="0.5,0">
                        <GradientStop Color="#FF181818" />
                        <GradientStop Color="#FF7A7A7A"
                                      Offset="0.5" />
                        <GradientStop Color="#FF1A1A1A"
                                      Offset="1" />
                    </LinearGradientBrush>
                </fluid:ElementFlow.Background>
                <fluid:ElementFlow.Camera>
                    <PerspectiveCamera FieldOfView="100"
                                       Position="0,1,4"
                                       LookDirection="0,-1,-4" />
                </fluid:ElementFlow.Camera>
            </fluid:ElementFlow>
        </Grid>

        <Grid Grid.RowSpan="3" x:Name="WrapViewGrid" Background="{StaticResource BackgroundBrush}" Visibility="Collapsed">
            <ListBox ItemsSource="{Binding Images}" BorderThickness="0" Background="{x:Null}"
                     ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <WrapPanel/>
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        
                        <Border Name="visualBorder" BorderThickness="1" BorderBrush="Transparent" Background="Transparent" Margin="3" Padding="5">
                            <Grid>
                                <Image Source="{Binding Thumbnail}" Width="100" Height="100"
                                       Stretch="Uniform" MouseDown="Image_MouseDown" ImageFailed="Image_ImageFailed"/>
                                <!--<Ellipse Width="5" Height="5" HorizontalAlignment="Center" VerticalAlignment="Bottom" Fill="LightGreen"
                                         Visibility="{Binding IsLocal, Converter={StaticResource ResourceKey=bool2VisibilityConverter}}"/>-->
                                <!--<Polygon HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="5"
                                         Visibility="{Binding IsLocal, Converter={StaticResource ResourceKey=bool2VisibilityConverter}, Mode=OneWay}"
                                         Points="0,9 4.5,0 10,9" Fill="#8899FF99"/>-->
                                <Image Source="../../Resource/Media/Image/Save.png" Opacity="0.7"
                                       HorizontalAlignment="Right" VerticalAlignment="Bottom"
                                       Width="16" Height="16" Margin="1"
                                       Visibility="{Binding IsLocal, Converter={StaticResource ResourceKey=bool2VisibilityConverter}, Mode=OneWay}"/>
                                <TextBlock Foreground="Red" Text="{Binding StatusID}"/>
                                <CheckBox Name="check" HorizontalAlignment="Right" VerticalAlignment="Bottom" Visibility="Collapsed">
                                    <CheckBox.Style>
                                        <Style>
                                            <Style.Triggers>
                                                <Trigger Property="CheckBox.IsChecked" Value="True">
                                                    <Setter Property="FrameworkElement.Visibility" Value="Visible"/>
                                                </Trigger>
                                            </Style.Triggers>
                                        </Style>
                                    </CheckBox.Style>
                                </CheckBox>
                            </Grid>
                            <Border.ToolTip>
                                <TextBlock Text="{Binding StatusModel.CreateTime}"/>
                            </Border.ToolTip>
                        </Border>
                        <DataTemplate.Triggers>
                            <Trigger Property="FrameworkElement.IsMouseOver" Value="True">
                                <Setter TargetName="visualBorder" Property="Border.BorderBrush"
                                        Value="{StaticResource HighlightBrush}"/>
                                <Setter TargetName="check" Property="Visibility" Value="Visible"/>
                            </Trigger>
                        </DataTemplate.Triggers>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </Grid>
    </Grid>
</Window>
